<?php

if (isset($_POST["username"]))
{
//declare variables
$user=$_POST["username"];
$pwd=$_POST["password"];
//make connection to database	
$dataUser=mysqli_query($newcon,"SELECT * from client where client_username='$user'");
$bil_rekod=mysqli_num_rows($dataUser);
$showData=mysqli_fetch_array($dataUser);
                        
 //check status of record
 	if ($bil_rekod==0)
    {
		?>
		 <div class="alert alert-danger alert-dismissable">
                                <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
                                Wrong username or password!.
                            </div>
                       
	<?php
    }
     elseif ($showData['client_password']!=md5($pwd))	
	 {                   
      	?>
		 <div class="alert alert-danger alert-dismissable">
                                <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
                                Wrong username or password!.
                            </div>
                       
	<?php
	}
	else
	{
	//set login credentials	
	$_SESSION["username"]=$showData['client_username'];
	header ("location: index3.php");
		
		
	}
}
	?>
                        <form role="form" method="post">
                            <fieldset>
                                <div class="form-group">
                                    <input class="form-control" placeholder="Username" name="username" type="text" autofocus>
                                </div>
                                <div class="form-group">
                                    <input class="form-control" placeholder="Password" name="password" type="password" value="">
                                </div>
                               
                                <!-- Change this to a button or input when using this as a form -->
                                <button href="index.html" class="btn btn-lg btn-success btn-block">Login</button>
                            </fieldset>
                        </form>
                        
                        
              <br>
                        <br>
                        
                    Not a member? Click <a href="register.php">here</a> to register </p>
                        <p>
						
						 <span class="fa fa-user"></span> <?php echo $developer; ?><br>
                        <span class="fa fa-envelope-o "></span> <?php echo $edev; ?><br>
                        <span class="fa fa-phone"></span> <?php echo $pdev; ?><br>
                        <span class="fa glyphicon-copyright-mark"></span> <?php echo $cright; ?><br>           
                        
                        
                    </div>
                </div>
            </div>
        </div>
    </div>
